package com.hejielife.future1;

/**
 * 2019年8月2日 下午4:24:13
 * 
 * @author hejielife
 * @despribe FutureData
 */
public class FutureData implements Data {
	private RealData realdata = null;
	private boolean ready = false;

	public synchronized void setRealData(RealData realdata) {
		if (ready) {
			return; // balk
		}
		this.realdata = realdata;
		this.ready = true;
		notifyAll();
	}

	public synchronized String getContent() {
		while (!ready) {
			try {
				wait();
			} catch (InterruptedException e) {
			}
		}
		return realdata.getContent();
	}
}
